/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       creature_select_window.h

	$Header: /game/creature_select_window.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef CREATURE_SELECT_WINDOW_H_INCLUDED
#define CREATURE_SELECT_WINDOW_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "bitmap_group_ptr.h"
#include "button_group.h"
#include "game_window.h"
#include "handler.h"

class t_creature_stack;
class t_creature_select_window;

typedef t_handler_2<t_creature_select_window*, t_creature_stack*> t_creature_select_handler;

// ------------------------------------------------------------
// control which allows you to select one or more creatures
// ------------------------------------------------------------
class t_creature_select_window : public t_window
{
public:
	t_creature_select_window( t_screen_point point, bool single_select, t_window* parent );

	void				add( t_creature_stack const* stack, bool display_only = false, bool force_awake_portrait = false );
	void				enable( int id, bool arg = true );
	bool				is_enabled( int id ) const;
	int					get_count() const;
	t_creature_stack*	get_creature( int id ) const;
	bool				is_selected( int id ) const;
	void                select_first();
	void                select_all();
    void                select_none();
	void				set_handler( t_creature_select_handler handler );
	void				set_help_text( int id, std::string const& text );
protected:
	void button_click( t_button* button, t_creature_stack* stack );

	t_bitmap_group_ptr             m_bitmaps;
	std::vector<t_toggle_button*>  m_buttons;
	t_button_group                 m_button_group;
	std::vector<t_creature_stack*> m_creatures;
	t_creature_select_handler	   m_handler;
	std::vector<t_window_ptr>      m_labels;
	bool                           m_single_select;
};

inline int t_creature_select_window::get_count() const
{
	return m_buttons.size();
}

inline t_creature_stack* t_creature_select_window::get_creature( int id ) const
{
	return m_creatures[id];
}

inline void t_creature_select_window::set_handler( t_creature_select_handler handler )
{
	m_handler = handler;
}


class t_creature_toggle_window : public t_creature_select_window
{
public:
	t_creature_toggle_window( t_screen_point point, t_window* parent );

protected:
	void button_click( t_button* button, t_creature_stack* stack );
};

#endif // CREATURE_SELECT_WINDOW_H_INCLUDED
